<html lang="zh-CN">

<head> {% load bootstrap4 %} {% bootstrap_css %} {% bootstrap_javascript %} <title>产品自动化测试平台</title>
</head>

<body role="document">

    <!—bug列表-->
    <div class="row" style="padding-top: 70px;">
        <!-- 导航栏-->
        <nav class="navbar navbar-expand-sm bg-dark navbar-dark fixed-top">
            <div class="container"> <a class="navbar-brand" href="#">&nbsp;</a>
                <ul class="nav justify-content-center"> </ul>
                <ul class="nav justify-content-end">
                    <li class="nav-link"><a style='color:white' href="#">{{user}}</a></li>
                    <li class="nav-link"><a style='color:white' href="/logout/">退出</a></li>
                </ul>
            </div>
        </nav>

        <!-- 搜索栏-->
        <div class="page-header" style="padding-left: 20px;">
            <form class="navbar-form" method="get" action="/bugsearch/">
                {% csrf_token %}
                <input type="search" name="bugname" placeholder="名称" required>
                <button type="submit">搜索</button>
            </form>
        </div>
    <!-- 增加 bug-->
        <div style="float:right;width:73%">
            <select name="Bug" id="id_Bug">
                <option value="" selected>----bug 名称----</option>
            </select>
            <a class="related-widget-wrapper-link change-related" id="change_id_Set" data-href- template="/admin/bug/bug/ fk /change/?_to_field=id&amp;_popup=1" title="更改选中的 bug">
                <img src="/static/admin/img/icon-changelink.svg" alt="修改" />
            </a>
            <a class="related-widget-wrapper-link add-related" id="add_id_Set" href="/admin/bug/bug/add/?_to_field=id&amp;_popup=1" title="增加另一个系统设置">
                <img src="/static/admin/img/icon-addlink.svg" alt="增加" />增加
            </a>
            </form>
        </div>
        <div class="col-md-11">
            <table class="table table-striped">
                <thead>
                    <tr>
                        <th>ID</th>
                        <th>产品</th>
                        <th>bug名称</th>
                        <th>bug详情</th>
                        <th>解决状态</th>
                        <th>严重程度</th>
                        <th>创建人</th>
                        <th>分配给</th>
                        <th>创建时间</th>
                        <th>编辑</th>
                        <th>删除</th>
                    </tr>
                </thead>
                <tbody> {% for bug in bugs %}
                    <tr>
                        <td>{{ bug.id }}</td>
                        <td>{{ bug.Product.productname }}</td>
                        <td>{{ bug.bugname }}</td>
                        <td title="{{ bug.bugdetail }}">{{ bug.bugdetail }}</td>
                        <td>{{ bug.bugstatus }}</td>
                        <td>{{ bug.buglevel }}</td>
                        <td>{{ bug.bugcreater }}</td>
                        <td>{{ bug.bugassign }}</td>
                        <td>{{ bug.created_time }}</td>
                        <td><a style='color:light blue' class="related-widget-wrapper-link add-related" id="add_id_Bug" href="../admin/bug/bug/{{ bug.id}}/change/?_to_field=id&_popup=1"><img src="/static/admin/img/icon-changelink.svg"/></a></td>
                        <td><a style='color:light blue' class="related-widget-wrapper-link add-related" id="add_id_Bug" href="../admin/bug/bug/{{ bug.id}}/delete/?_to_field=id&_popup=1"><img src="/static/admin/img/icon-deletelink.svg"/></a></td>
                {% endfor %} </tbody>

            </table>
        </div>
    </div>

    <!--统计和翻页功能-->
   <span style="position:absolute; right:100px; bottom:30px;"> {# 把翻页功能固定显示在右下角#}
        <div style="position:absolute;	right:100px; width:100px; ">
        <tr><th>共:</th><td>{{ bugcounts }}</td><th>条记录</th></tr> {# 前端读取定义的变量#}
        </div>

        <div class="container">
            <ul class="pagination" id="pager">
                {# 上一页链接开始#}
                {% if bugs.has_previous %}
                {# 如果有上一页，则正常显示上一页的链接#}
                <li class="previous"><a href="/bug_manage/?page={{ bugs.previous_page_number }}">上一页
                    </a></li> {# 上一页标签 #}
                {% else %}
                <li class="previous disabled"><a href="#">上一页</a></li> {# 如果当前不存在上一页，则上一页的链接不可单击#}
                {% endif %}
                {# 上一页链接开始#}
                {% for num in bugs.paginator.page_range %}
                {% if num == currentPage %}
                <li class="item active"><a href="/bug_manage/?page={{ num }}">{{ num }}</a></li> {#显示当前页数链接#}
                {% else %}
                <li class="item"><a href="/bug_manage/?page={{ num }}">{{ num }}</a></li>
                {% endif %}
                {% endfor %}
                {# 下一页链接开始#}
                {% if bugs.has_next %} {# 如果有下一页，则正常显示下一页的链接#}
                <li class="next"><a href="/bug_manage/?page={{ bugs.next_page_number }}">下一页</a></li>
                {% else %}
                <li class="next disabled"><a href="#">下一页</a></li>
                {% endif %}
                {# 下一页链接结束#}
            </ul>
        </div>
    </span>
</body>

</html>